<!DOCTYPE html>
<html class="um landscape min-width-240px min-width-320px min-width-480px min-width-768px min-width-1024px">
    <head>
        <title></title>
        <meta charset="utf-8">
        <meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
        <link rel="stylesheet" href="../css/fonts/font-awesome.min.css">
        <link rel="stylesheet" href="../css/ui-box.css">
        <link rel="stylesheet" href="../css/ui-base.css">
        <link rel="stylesheet" href="../css/ui-color.css">
        <link rel="stylesheet" href="../css/appcan.icon.css">
        <link rel="stylesheet" href="../css/appcan.control.css">
        <link rel="stylesheet" href="../css/my/style.css">
    </head>
    <body class="um-vp " ontouchstart>
        <div id="page_0" class="my-body up ub ub-ver bc-bg" tabindex="0">
            <!--header开始-->
            <div id="header" class="my-header uh bc-text-head ub bc-head">
                <!-- 返回按钮开始 -->
                <div class="nav-btn" id="nav-left">
                    <div class="fa fa-angle-left ulev2"></div>
                </div>
                <!-- 返回按钮结束 -->
                <h1 class="ut ub-f1 ulev-3 ut-s tx-c" tabindex="0">SMBLog</h1>
                <div class="nav-btn" id="nav-right">
                    <div class="fa fa-trash-o ulev2"></div>
                </div>
            </div>
            <div id="content" class="my-content-full1" style="background: #ebebeb;">
                <div id="idLogList" class="ub-ver ub-f1 uinn-i1"></div>
            </div>
        </div>
        <script src="../js/appcan.js"></script>
        <script src="../js/appcan.control.js"></script>
        <script src="../js/appcan.listview.js"></script>
        <script src="../js/appcan.tab.js"></script>
        <script src="../js/os/jroll.js"></script>
        <script src="../js/os/jroll-pulldown.js"></script>
        <script src="../js/my/smb.utils.js"></script>
        <script src="../js/my/smb.request.js"></script>
        <script src="../js/my/smb.window.js"></script>
        <script src="../js/my/smb.localStorage.js"></script>
        <script src="../js/my/smb.log.js"></script>
    </body>
    <script>
        var myScroll = undefined;
        var pageName = "SMBLog";
        appcan.ready(function() {
            pageName = smb_GetLatestOpenedWindow() || pageName;
            appcan.button("#nav-left", "ani-act", function() {
                smb_CloseWindow(-1);
            })
            appcan.button("#nav-right", "ani-act", function() {
                smb_ClearLogs();
                fnLoadLogs();
            })
            myScroll = smb_Scroll("#content");
            setTimeout(function() {
                fnLoadLogs();
            }, 200);
        });

        function fnLoadLogs() {
            appcan.window.openToast({
                msg : '加载中...',
                duration : 0,
                position : 5,
                type : 0
            });
            var container = $("#idLogList").html('');
            var objJson = smb_ListLogs();
            if (objJson && objJson.length > 0) {
                for (var i = 0; i < objJson.length; i++) {
                    var obj = objJson[i];
                    var line = "<div class='ubb bc-border ub-f1 ub-ver'>";
                    line += "<div class='uinn3 ub-f1 sc-text-warn'>" + smb_TimeToString(obj.time, 1) + "</div>";
                    line += "<div class='ub-f1' style='padding:0 0.5em 0 2em;margin:0;word-wrap:break-word;'>" + obj.description + "</div>";
                    line += "</div>";
                    container.append(line);
                }
            } else {
                container.html('<div class="ub"><div class="sc-text-warn" style="margin: 0 auto;">无Log记录！</div></div>');
            }
            myScroll.refresh();
            appcan.window.closeToast();
        }
    </script>
</html>